import grails.test.*

class ProjectTests extends GrailsUnitTestCase {
    protected void setUp() {
      super.setUp()
    }

    protected void tearDown() {
      super.tearDown()
    }

    void testProjectInstanziation()
    {

        project proj = new Project(projectId: "10", name: "testProj", description: "Proj to test project",
                                    startDate: new Date(2009,10,22), endDate: new Date(2009,11,01), lab: "lab1")

        assertEquals proj.projectId, "10"
        assertEquals proj.name, "testProj"
        assertEquals proj.description, "Proj to test project"
        assertEquals proj.startDate, new Date(2009,10,22)
        assertEquals proj.endDate, new Date(2009,11,01)

    }

    void testCalcStatus()
    {

        project proj1 = new Project(projectId: "11", name: "testProj", description: "Proj to test project",
                                    startDate: new Date(2010,01,22), endDate: new Date(2010,02,05), lab: "lab1")

        project proj2 = new Project(projectId: "12", name: "testProj", description: "Proj to test project",
                                    startDate: new Date(2009,07,22), endDate: new Date(2009,10,01), lab: "lab1")

        project proj3 = new Project(projectId: "13", name: "testProj", description: "Proj to test project",
                                    startDate: new Date(2009,10,05), endDate: new Date(2009,12,01), lab: "lab1")

        assertEquals proj1.calcstatus, "Planned"
        assertEquals proj2.calcstatus, "Done"
        assertEquals proj3.calcstatus, "Progressing"

    }
}
